const db = unicloud.database()
exports.main = async (event, context) => { //获取user表的集合对象
	const collection = db.collection('user')
	let user //操作云数据库，查找user表中username为event.username同时password为event.password的对象

	user = await collection.where({
		username: event.username,
		password: event.password1
	}).get()
	// affectedDocs表示从服务器查询到的数据条数 if (user.affectedDocs <1){//没有找到
	if (user.affectedDocs < 1) {
		return {
			code: -1,
			msg: '用户名或密码错误'
		}
	} else {
		return {
			code: 0,
			msg: 'success'
		}
	}
}

